package com.taxi.driver.common;

import android.content.res.Resources;

import com.taxi.driver.BuildConfig;
import com.taxi.driver.R;

/**
 * 功能描述：应用配置
 */
public class AppConfig {

    public final static String TAXI = "taxi"; //出租车
    public final static String SPECIAL = "special"; //专车
    public final static String CARPOOL = "carpool"; //跨城拼车
    public final static String REQUEST_KEY = "fffa2a879e62e198924a95dc150dc33823bd0bf7abd3a20fff605f297ae9333804699723a6219048";

    public static String YUEYUE_APPKEY = ""; //AppKey
    public static String HOST = ""; //服务器地址
    public static String WS = ""; //长链接地址
    public static String BUGLY_ID = ""; //bugly版本升级id
    public static String AMAP_ID = ""; //高德地图id
    public static String WX_APPID = ""; //微信支付id

    public static void initConfig(Resources res) {
        if (BuildConfig.DEBUG) {
            HOST = res.getString(R.string.host_debug);
            WS = res.getString(R.string.ws_debug);
            BUGLY_ID = res.getString(R.string.bugly_id_debug);
        } else {
            HOST = res.getString(R.string.host);
            WS = res.getString(R.string.ws);
            BUGLY_ID = res.getString(R.string.bugly_id);
        }
        AMAP_ID = res.getString(R.string.amap_id);
        YUEYUE_APPKEY = res.getString(R.string.yueyue_appkey);
        WX_APPID = res.getString(R.string.wechat_id);
    }

    /**
     * 是否是"出租车"业务
     *
     * @return
     */
    public static boolean isTaxi() {
        return TAXI.equals(BuildConfig.FLAVOR_type);
    }

    /**
     * 是否是"专车"业务
     *
     * @return
     */
    public static boolean isSpecial() {
        return SPECIAL.equals(BuildConfig.FLAVOR_type);
    }

    /**
     * 是否是"跨城拼车"业务
     *
     * @return
     */
    public static boolean isCarpool() {
        return CARPOOL.equals(BuildConfig.FLAVOR_type);
    }


    /**
     * 获取司机端业务类型（出租车、专车、跨城拼车或货运车）
     *
     * @return
     */
    public static int getCarType() {
        if (isTaxi()) return 1;
        if (isSpecial()) return 2;
        if (isCarpool()) return 3;
        return 0;
    }

}
